<html>
	<head>
	<title>School Enrolment :: Requirements</title>
    <?php 
		require_once '../commons.php';
		renderHeaderStyles();
	?>
  </head>
  <body>
    Requirements for Enrolment
    <form action="<?= $_SERVER['PHP_SELF'] ?>">
      <?php
        require_once "../../Controllers/EnrolmentRequirementController.php";
        $e = new EnrolmentRequirementController();
        //
        $bEditMode =  isset($_POST['editMode']) ?
                      $_POST['editMode'] :
                      false;
        //
        if(isset($_POST['save']))
        {
          $e->setHasOriginalReportCard($_POST['reportCard']);
          $e->setHasBirthCertificate($_POST['birthCertificate']);
          $e->setHasGoodMoralCharacter($_POST['goodMoral']);
          $e->setHasBaptismalCertificate($_POST['baptismal']);
          $e->setHasCarrierPicture($_POST['carrierPicture']);
        }
      ?>
      <input  type="hidden"
              name="editMode"
              value="<?php !$bEditMode; ?>" />
      <table align="center">
        <?php
          function getWrappedTr($value,
                                $name,
                                $hasSubmitted)
          {
            echo "<tr>";
            //
            $b = $hasSubmitted ? 'true' : 'false';
            global $bEditMode;
            $e = $bEditMode ? '' : 'disabled';
            $s =  "<input type=\"checkbox\" $e " .
                  "checked=\"$b\" name=\"$name\" />";
            //
            echo "<td>$value $s</td>";
            //
            echo "</tr>";
          }
          require_once "../../Controllers/StudentController.php";
          $s = new StudentController();
          $b = $s->getIsTransferee();
          if($b)
          {
            echo  getWrappedTr("Original Report Card",
                  "reportCard",
                  $e->getHasOriginalReportCard());
          }
          echo  getWrappedTr("Birth Certificate from NSO",
                "birthCertificate",
                $e->getHasBirthCertificate());
          if($b)
          {
            echo  getWrappedTr("Certificate of Good Moral Character",
                  "goodMoral",
                  $e->getHasGoodMoralCharacter());
          }
          echo  getWrappedTr("Recent copy of Baptismal Certificate",
                "baptismal",
                $e->getHasBaptismalCertificate());
          //
          if($s->getIsPreElementary())
          {
            $s =  "One 2x2 picture of Carrier.<br />" .
                  "<span style=\"color:#666666;\">*A Carrier " .
                  "is a person that is authorized by the " .
                  "parents or guardians to pick " .
                  "up the child after classes.</span>";
            echo  getWrappedTr($s,
                  "carrierPicture",
                  $e->getHasCarrierPicture());
          }
        ?>
      </table>
      <table align="center">
        <tr>
          <td>
            <?php $s = $bEditMode ? 'Update' : 'Save'; ?>
            <input  type="submit"
                    value="<?= $s ?>"
                    name="<?= to_lower($s); ?>" />
          </td>
        </tr>
      </table>
    </form>
  </body>
</html>